/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is Forte for Java, Community Edition. The Initial
* Developer of the Original Code is Sun Microsystems, Inc. Portions
* Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.updater;
import java.awt.Dimension;
/**
*
* @author phrebejk
* @version
*/
public class UpdaterFrame extends javax.swing.JFrame {
private static UpdaterFrame frame;
private static boolean bigBounds = false;
private static ModuleUpdater mu = null;
/** Creates new form UpdaterFrame */
public UpdaterFrame() {
initComponents ();
pack ();
center();
}
private void center() {
// standard way how to place the dialog to the center of the screen
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
Dimension dialogSize = getSize();
setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents () {//GEN-BEGIN:initComponents
jPanel1 = new javax.swing.JPanel ();
jLabel3 = new javax.swing.JLabel ();
jTextArea1 = new javax.swing.JTextArea ();
textLabel = new javax.swing.JLabel ();
progressBar = new javax.swing.JProgressBar ();
setTitle (java.util.ResourceBundle.getBundle("org/netbeans/updater/Bundle").getString("UpdaterFrame.Form.title"));
addWindowListener (new java.awt.event.WindowAdapter () {
public void windowClosing (java.awt.event.WindowEvent evt) {
exitForm (evt);
}
}
);
jPanel1.setLayout (new java.awt.GridBagLayout ());
java.awt.GridBagConstraints gridBagConstraints1;
jPanel1.setBackground (new java.awt.Color (102, 102, 153));
jPanel1.setBorder (new javax.swing.border.EmptyBorder(new java.awt.Insets(0, 0, 0, 0)));
jLabel3.setIcon (new javax.swing.ImageIcon (getClass ().getResource ("/org/netbeans/updater/resources/forteUpdater.gif"))); // NOI18N
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
jPanel1.add (jLabel3, gridBagConstraints1);
jTextArea1.setDisabledTextColor (java.awt.Color.white);
jTextArea1.setOpaque (false);
jTextArea1.setBackground ((java.awt.Color) javax.swing.UIManager.getDefaults ().get ("Label.background")); // NOI18N
jTextArea1.setText (java.util.ResourceBundle.getBundle("org/netbeans/updater/Bundle").getString("UpdaterFrame.jTextArea1.text"));
jTextArea1.setForeground (java.awt.Color.white);
jTextArea1.setEditable (false);
jTextArea1.setFont (new java.awt.Font ("Dialog", 0, 12)); // NOI18N
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints1.insets = new java.awt.Insets (8, 14, 0, 14);
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.weighty = 1.0;
jPanel1.add (jTextArea1, gridBagConstraints1);
textLabel.setText (java.util.ResourceBundle.getBundle("org/netbeans/updater/Bundle").getString("UpdaterFrame.textLabel.text"));
textLabel.setForeground (java.awt.Color.white);
textLabel.setFont (new java.awt.Font ("Dialog", 1, 11)); // NOI18N
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.insets = new java.awt.Insets (8, 14, 8, 14);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add (textLabel, gridBagConstraints1);
progressBar.setPreferredSize (new java.awt.Dimension(300, 20));
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (5, 14, 10, 14);
gridBagConstraints1.weightx = 1.0;
jPanel1.add (progressBar, gridBagConstraints1);
getContentPane ().add (jPanel1, java.awt.BorderLayout.CENTER);
}//GEN-END:initComponents
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
// System.exit (0);
}//GEN-LAST:event_exitForm
/**
* @param args the command line arguments
*/
public static void main (String args[]) {
frame = new UpdaterFrame ();
frame.show ();
mu = new ModuleUpdater();
mu.start();
}
static void unpackingFinished() {
runningFinished();
/*
ClassRunner runner = new ClassRunner();
runner.start();
*/
}
static void runningFinished() {
System.exit( 0 );
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JLabel textLabel;
private javax.swing.JProgressBar progressBar;
// End of variables declaration//GEN-END:variables
static void setLabel( final String text ) {
final javax.swing.JLabel label = frame.textLabel;
javax.swing.SwingUtilities.invokeLater( new Runnable() {
public void run() {
label.setText( text );
}
});
}
static void setProgressRange( final long min, final long max ) {
bigBounds = max > 0xFFFF;
final javax.swing.JProgressBar progressBar = frame.progressBar;
final boolean bb = bigBounds;
javax.swing.SwingUtilities.invokeLater( new Runnable() {
public void run() {
progressBar.setMinimum( bb ? (int)(min / 1024) : (int)min );
progressBar.setMaximum( bb ? (int)(max / 1024) : (int)max );
}
});
}
static void setProgressValue( final long value ) {
final javax.swing.JProgressBar progressBar = frame.progressBar;
final boolean bb = bigBounds;
javax.swing.SwingUtilities.invokeLater( new Runnable() {
public void run() {
progressBar.setValue( bb ? (int)(value / 1024) : (int)value );
}
});
}
}
/*
* Log
* 7 Gandalf 1.6 1/13/00 Petr Hrebejk i18n
* 6 Gandalf 1.5 11/15/99 Petr Hrebejk NbBundle reference
* removed from form
* 5 Gandalf 1.4 11/15/99 Petr Hrebejk New Sun design
* 4 Gandalf 1.3 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun
* Microsystems Copyright in File Comment
* 3 Gandalf 1.2 10/12/99 Petr Hrebejk Backs up the replaced
* files
* 2 Gandalf 1.1 10/7/99 Petr Hrebejk
* 1 Gandalf 1.0 10/6/99 Petr Hrebejk
* $
*/